﻿#region Copyrights Notice
//©2010 Microsoft Corporation. All rights reserved.
#endregion

#region usings
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Microsoft.InformationSecurity.CISF.SecurityPortal.Business.Entities
{
    public class WidgetInstance
    {
        #region Private properties
            //Private properties
            private Widget ctrlWidgetControl;

            private int nCol;
            private int nRow;
            private Int32 nRealInstanceID;
            private Int32 nControlID;
            private Int32 nUserId;
            private bool nIsExpanded;
            private string strCaption;
            private string xmlStorage;
            private int nVersion;

        #endregion

        #region Public properties
            public WidgetInstance(Widget w)
            {
                ctrlWidgetControl = w;
                nControlID = w.WidgetId;
                strCaption = w.Name;
                xmlStorage = w.DefaultState;
                nVersion = w.VersionNo;
            }

            public WidgetInstance()
            {
                ctrlWidgetControl = new Widget();
            }

            public int TableColPos
            {
                get { return nCol; }
                set { nCol = value; }
            }
            public int TableRowPos
            {
                get { return nRow; }
                set { nRow = value; }
            }
            public Int32 WidgetInstanceId
            {
                get { return nRealInstanceID; }
                set { nRealInstanceID = value; }
            }
            public Int32 WidgetId
            {
                get { return nControlID; }
                set { nControlID = value; }
            }
            public Int32 UserId
            {
                get { return nUserId; }
                set { nUserId = value; }
            }
            public bool IsExpanded
            {
                get { return nIsExpanded; }
                set { nIsExpanded = value; }
            }
            public int Expanded
            {
                get
                {
                    if (nIsExpanded)
                        return 1;
                    else
                        return 0;
                }

            }
            public void SetExpanded(int Expanded)
            {
                if (Expanded == 1)
                    nIsExpanded = true;
                else
                    nIsExpanded = false;

            }
            public string Caption
            {
                get { return strCaption; }
                set { strCaption = value; }
            }
            public string State
            {
                get { return xmlStorage; }
                set { xmlStorage = value; }
            }
            public int VersionNo
            {
                get { return nVersion; }
                set { nVersion = value; }
            }
            public Widget Widget
            {
                get { return ctrlWidgetControl; }
                set { ctrlWidgetControl = value; }
            }

        #endregion

    }
}
